<!doctype html>
<html>

<head>
    <meta charset="UTF-8" />
    <title>TPFrame 6.0 后台管理中心</title>
    <meta http-equiv="X-UA-Compatible" content="chrome=1,IE=edge" />
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta name="robots" content="noindex,nofollow">
    <link href="__THEMES__/css/admin_login.css" rel="stylesheet" />
    <script src="__THEMES__/js/jquery.min.js"></script>
    <script type="text/javascript" src="__THEMES__/js/jparticle.min.js"></script>
    <style>
    body{width:100wh; height:100vh; color: #fff;overflow:hidden;
    background:linear-gradient(-45deg, rgba(236,83,81,0.2), rgba(7,95,124,0.7), rgba(117,113,251,0.7), rgba(7,95,124,0.7), rgba(236,83,81,0.2));
    background-size: 400% 400%;-webkit-animation: Gradient 15s ease infinite;-moz-animation: Gradient 15s ease infinite;animation: Gradient 15s ease infinite;}
    @-webkit-keyframes Gradient {
        0% {background-position: 0% 50%}
        50% {background-position: 100% 50%}
        100% {background-position: 0% 50%}
    }

    @-moz-keyframes Gradient {
        0% {background-position: 0% 50%}
        50% {background-position: 100% 50%}
        100% {background-position: 0% 50%}
    }

    @keyframes Gradient {
        0% {background-position: 0% 50%}
        50% { background-position: 100% 50%}
        100% {background-position: 0% 50%}
    }
    .particle-container{width: 100%; height: 100%; position: fixed;}
    #login_btn_wraper {text-align: center;}

    #login_btn_wraper .tips_success {color: #fff;}

    #login_btn_wraper .tips_error { color: #DFC05D;}

    #login_btn_wraper button:focus {outline: none;}

    img[alt='captcha'] {cursor: pointer;}
    .login-wrap{position: fixed; z-index: 100; width: 100%; height: 100%;}
    #errTip {
        margin-top: 6px;
        text-align: center;
        color: #333;
    }
    </style>
    <script>
    if (window.parent !== window.self) {
        document.write = '';
        window.parent.location.href = window.self.location.href;
        setTimeout(function() {
            document.body.innerHTML = '';
        }, 0);
    }
    $(function() {
        /*
        $(".particle-container").jParticle({
            background: "rgba(0,0,0,0)",
            color: "#fff",             
            particlesNumber:100,       
            //disableLinks:true,
            //disableMouse:true,
            particle: {
                minSize: 1,
                maxSize: 3,
                speed: 30,
             }
        });
        */
        $("img[alt='captcha']").click(function() {
            $(this).attr("src", "/captcha.html?t=" + Math.random());
        });
        $("#loginBtn").click(function() {
            var username = $.trim($("#js-admin-name").val()),
                pass = $("#admin_pwd").val(),
                verify = $("#verify").val();
            if (username.length == 0) {
                $("#errTip").show().html("用户名不能为空").fadeOut(1000);
                $("#js-admin-name").focus();
                return;
            }
            if (pass.length < 3 || pass.length > 18) {
                $("#errTip").show().html("密码长度在3-18位之间").fadeOut(1000);
                $("#admin_pwd").focus();
                return;
            }
            {eq name=":config('config.ADMIN_LOGIN_VERIFY_SWITCH')" value="1"}
            if (verify.length == 0) {
                $("#errTip").show().html("验证码不能为空").fadeOut(1000);
                $("#verify").focus();
                return;
            }
            {/eq}
            $.post('{:url("backend/User/login")}', { "username": username, "password": pass, "captcha": verify, "t": (new Date()).getTime() },
                function(data) {
                    if (data.code != 0) {
                        $("#errTip").show().html(data.msg).fadeOut(1000);
                        $("img[alt='captcha']").attr("src", "/captcha.html?t=" + Math.random());
                        return;
                    }
                    $("#errTip").show().html(data.msg).fadeOut(1000, function() {
                        location.href = '{:url("backend/Index/index")}';
                    });
                }, "json");
        });
        $(".keydonw").keydown(function(e) {
            // 得到键盘的keycode码
            if (event.which == 13) {
                $("#loginBtn").click();
            }
        });

    });
    </script>
</head>

<body>
    <div class="particle-container"></div>
    <div class=" flex flex-align-center flex-pack-center login-wrap">
        <div class="wrap">
            <h1 style="text-align: center;"><img src="__THEMES__/images/login_logo2.png" style="width:68px; height: auto;"></h1>
            <div class="login">
                <ul>
                    <li>
                        <input class="input keydonw" id="js-admin-name" name="username" type="text" placeholder="user id" title="username" data-rule-required="true" data-msg-required="" />
                    </li>
                    <li>
                        <input class="input keydonw" id="admin_pwd" type="password" name="password" placeholder="password" title="password" data-rule-required="true" data-msg-required="" />
                    </li>
                    {eq name=":config('config.ADMIN_LOGIN_VERIFY_SWITCH')" value="1"}
                    <li class="verifycode-wrapper">{:captcha_img()}</li>
                    <li>
                        <input class="input keydonw" type="text" name="verify" id="verify" placeholder="validate code" />
                    </li>
                    {/eq}
                </ul>
                <div id="login_btn_wraper">
                    <button type="button" name="submit" class="btn js-ajax-submit" id="loginBtn">Login In</button>
                </div>
                <div id="errTip"></div>
            </div>
        </div>
    </div>
</body>

</html>